package com.yang.controller.admin;

import com.yang.bean.MarketIssue;
import com.yang.bean.common.BaseRespVo;
import com.yang.bean.common.CommonData;
import com.yang.bean.yvo.IssueListBO;
import com.yang.service.admin.AdminIssueService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: 杨庆
 * @since: 2022.9.7 20:24
 * @description:
 */
@RestController
@RequestMapping("admin/issue")
public class AdminIssueController {

    @Autowired
    AdminIssueService adminIssueService;

    /**
    * @description: 查看所有的通用问题
    []
    * @return: com.yang.bean.common.BaseRespVo
    * @author: 杨庆
    * @time: 2022.9.7 20:26
     */
    @RequestMapping("list")
    public BaseRespVo list(IssueListBO issueListBO){
        CommonData commonData =  adminIssueService.selectIssue(issueListBO);
        return BaseRespVo.ok(commonData);
    }

    /**
    * @description: 更新
    [marketIssue]
    * @return: com.yang.bean.common.BaseRespVo
    * @author: 杨庆
    * @time: 2022.9.7 21:19
     */
    @RequestMapping("update")
    public BaseRespVo update(@RequestBody MarketIssue marketIssue) {
        MarketIssue marketIssue1 = adminIssueService.updateIssue(marketIssue);
        return BaseRespVo.ok(marketIssue1);
    }
    /**
    * @description: 删除，只是修改了delete的值
    [marketIssue]
    * @return: com.yang.bean.common.BaseRespVo
    * @author: 杨庆
    * @time: 2022.9.7 21:19
     */
    @RequestMapping("delete")
    public BaseRespVo delete(@RequestBody MarketIssue marketIssue) {
        adminIssueService.delete(marketIssue);
        return BaseRespVo.ok();
    }

    @RequestMapping("create")
    public BaseRespVo create(@RequestBody MarketIssue marketIssue) {
        MarketIssue marketIssue1 = adminIssueService.create(marketIssue);
        return BaseRespVo.ok(marketIssue1);
    }
}
